﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class TestWindow : EditorWindow , IHasCustomMenu
{

    private bool isOn;

    private void OnGUI()
    {
        if (GUILayout.Button("testWindow button")) {
            Debug.Log("test window button! ");
        }

    }

    private void Awake()
    {
        //Debug.Log(" test awake ");
    }

    private void OnDestroy()
    {
        //Debug.Log(" test OnDestroy ");
    }

    private void OnFocus()
    {
        //Debug.Log(" test OnFocus ");
    }

    private void OnLostFocus()
    {
        //Debug.Log(" test OnLostFocus ");
    }

    private void Update()
    {
        //Debug.Log(" test Update ");
    }

    public void AddItemsToMenu(GenericMenu menu)
    {
        menu.AddItem(new GUIContent("test1"), isOn, () => {
            Debug.Log("test1");

            isOn = !isOn;

            if (isOn)
            {
                // TODO On
            }
            else { 
                // TODO Off
            }

        });

        menu.AddDisabledItem(new GUIContent("test2"));

    }
}
